#ifndef Player_H
#define Player_H

#include<QMediaContent>
#include<QMediaPlayer>
#include<QObject>
#include<QTimer>
#include<QUrl>

class Player: public QObject
{
    enum PlayerState{
        Playing,
        Paused,
        Stopped
    };

Q_OBJECT
public:
    Player(QObject *parent = 0);
    ~Player();
public slots:
    void play(const QUrl &location);
    void play();
    void stop();
    void pause();
private slots:
    void slotStateChanged(QMediaPlayer::State state);
    void slotCheckState();
signals:
    void stopped();
    void paused();
    void playing();
private:
    QMediaPlayer *m_player;
    QTimer *m_stateCheckTimer;
    PlayerState m_desiredState;
};

#endif // Player_H
